﻿using EPiAbstractions.Community.Blog.Security;
using EPiServer.Community;
using EPiServer.Community.Blog;

namespace JoelAbrahamsson.BlogExtensions
{
    public static class BlogExtensions
    {
        public static bool CurrentUserIsAdministrator(this Blog blog)
        {
            if(CommunitySystem.CurrentContext.DefaultSecurity.CurrentUser == null)
                return false;

            return SecurityHandlerFacade.Instance.GetBlogAccessRights(blog, CommunitySystem.CurrentContext.DefaultSecurity.CurrentUser).Administrate;
        }
    }
}
